package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.BuyerCarBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IBuyerCarMapper extends BaseMapper<BuyerCarBean> {

    @Select("SELECT bc.*,p.p_name,p.`p_brand`,p.p_buyPrice FROM t_buyerCar bc,t_product p "+
            "WHERE bc.`fk_productId`=p.`pk_product` AND bc.`fk_userId`=#{userId};")
    @ResultMap("buyerCarMap")
    List<BuyerCarBean> findByUserId(Integer userId);

}

